<?php	
//1.msyql命令练习会
//2.将age>20岁的所有人，年龄+1
update student set age=age+1 where age>20;
//3.将年龄最小的同学删除
delete from student order by age asc limit 1;

//总结
//增
insert into student (sname,age) values ('admin888',18),('admin999',26);
replace into student (sname,age) values ('admin888',18),('admin999',26);
//删除
delete fron student where sid=10;
//修改
update student set sname='admin' where sid=10;
//查询
	//select XXX from XXX where XXX
	//1.单一或者多列，别名******
	select sid as s,sname as sn from student;
	//2.where******
	slect * from student where age>=30 and age<=50;
	select * from student where age between 30 and 50;
	//3.concat 连接******
	select concat(sname,'-',age) from student;
	//4.去重distinct******
	select distinct sname,age from student;
	//5.order by, limit******
	select * from student order by age desc limit 2,3;
	select * from student order by age desc,sid asc;
	select * from student order by rand() limit 6;
	//6.in(18,19,20)******
	select * from student where age in (18,19,20);
	//7.like 模糊匹配******
	select * from student where sname like "%张%";
	select * from student where sname like "_张_";
	//8.left mid right*
	select left(sname,2) from stuent;
	//9.查找为null*
	select * from student where sname is null;
	//10.if*
	select age,if(age>30,"大","小") from student;
	//11.查询结果自身比较*
	select age,age>30 from student;










